//
//  AppInfo.m
//  Project
//
//  Created by Suny on 14-8-22.
//  Copyright (c) 2014年 Suny. All rights reserved.
//

#import "AppInfo.h"
@interface AppInfo ()


@end

@implementation AppInfo
DEF_SINGLETON()


- (id)initWithCoder:(NSCoder *)coder
{
    self = [super init];
    if (self)
    {
        self.totalLoginNumber = [coder decodeIntForKey:@"self.totalLoginNumber"];
        self.currentLoginNumber = [coder decodeIntForKey:@"self.currentLoginNumber"];
        self.configVersion = [coder decodeObjectForKey:@"self.configVersion"];
        self.changedate = [coder decodeObjectForKey:@"self.changedate"];
        self.desc = [coder decodeObjectForKey:@"self.desc"];
        self.downloadUrl = [coder decodeObjectForKey:@"self.downloadUrl"];
        self.appStoreVersion = [coder decodeObjectForKey:@"self.appStoreVersion"];
        self.updateFlag = [coder decodeObjectForKey:@"self.updateFlag"];
    }

    return self;
}

- (void)encodeWithCoder:(NSCoder *)coder
{
    [coder encodeInt:self.totalLoginNumber forKey:@"self.totalLoginNumber"];
    [coder encodeInt:self.currentLoginNumber forKey:@"self.currentLoginNumber"];
    [coder encodeObject:self.configVersion forKey:@"self.configVersion"];
    [coder encodeObject:self.changedate forKey:@"self.changedate"];
    [coder encodeObject:self.desc forKey:@"self.desc"];
    [coder encodeObject:self.downloadUrl forKey:@"self.downloadUrl"];
    [coder encodeObject:self.appStoreVersion forKey:@"self.appStoreVersion"];
    [coder encodeObject:self.updateFlag forKey:@"self.updateFlag"];
}

- (BOOL)firstOpenApp
{
    if (![self.configVersion isEqualToString:kAppVersion])
    {
        return YES;
    }
    else
    {
        return NO;
    }
}


@end
